home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / PaperCut Quota / pc-setup.exe / {app} / WebAdmin / TopUpCard.asp < prev    next >
Text File  |  2004-10-05  |  2KB  |  96 lines

  1. <%@ Language=VBScript %>
  2. <%' (c) Copyright 1999-2004 PaperCut Software Pty. Ltd. %>
  3. <!-- #INCLUDE FILE="includes/PCCommon.inc" -->
  4. <!-- #INCLUDE FILE="includes/header.inc" -->
  5. <%
  6.  
  7. Dim objPCTopUpCards 
  8. Set objPCTopUpCards    = CreateObject("PCWebAdmin.PCTopUpCards")
  9. If objPCTopUpCards.Error Then
  10.     WriteErrorMessage objPCTopUpCards.ErrorDescription
  11. End If
  12.  
  13. Function GetProcessCardError(intError)
  14.     Dim s
  15.  
  16.     If intError = 0 Then
  17.         ' No error
  18.         s = ""
  19.     ElseIf intError = 1 Then
  20.         s = GetText("ErrorTUCExpired")
  21.     ElseIf intError = 2 Then
  22.         s = GetText("ErrorTUCUsed")
  23.     ElseIf intError = 3 Then        
  24.         s = GetText("ErrorTUCInvalid")
  25.     ElseIf intError = 4 Then
  26.         s = GetText("ErrorUnexpectedError") 
  27.     End If
  28.     
  29.     GetProcessCardError = s
  30. End Function
  31.  
  32.  
  33. Dim strCardNo
  34. strCardNo = UCase(Trim(Request("txtCardNo")))
  35.  
  36. If Not gblnIsLoggedIn Then
  37.     WriteErrorMessage GetText("ErrorUserNotLoggedIn")
  38. Else
  39.     ' Top up     
  40.     
  41.     If strCardNo <> "" and Request("txtSubmitted") <> "" Then
  42.         If objPCTopUpCards.ProcessCard(strCardNo, gstrLoggedInUser) Then
  43.             RedirectWithMessage "default.asp", GetText("TopUpSuccess")            
  44.         Else
  45.             WriteErrorMessage GetText("ErrorTUCUnableToProcess") & ". " & GetProcessCardError(objPCTopUpCards.ProcessErrorNo) & " " & GetText("ActionLogged") & ". " & objPCTopUpCards.ErrorDescription
  46.         End If
  47.     End If
  48.     
  49.     
  50. %>
  51.     <h1><%=GetText("UseTopUpCard")%></h1>    
  52.  
  53.     <p>
  54.         <%=GetText("TopUpCardInstr")%>        
  55.     </p>
  56.     
  57.     <p>
  58.         <b>
  59.         <%=GetText("TopUpCardInstrNote")%>        
  60.         </b>
  61.     </p>
  62.     
  63.     <FORM ACTION="TopUpCard.asp" METHOD="POST">
  64.         <INPUT type="hidden" name="txtSubmitted" value="Y">
  65.         <TABLE class="webAdmin">
  66.             <TR class="evenRow">
  67.                 <TH>
  68.                     <%=GetText("Username")%>:
  69.                 </TH>
  70.                 <TD>
  71.                     <% =Server.HTMLEncode(gstrLoggedInUser) %>                    
  72.                 </TD>
  73.             </TR>
  74.             <TR class="oddRow">
  75.                 <TH>
  76.                     <%=GetText("CardNumber")%>:
  77.                 </TH>
  78.                 <TD>
  79.                     <INPUT TYPE="text" name="txtCardNo" size="40" value="<% =Server.HTMLEncode(strCardNo) %>">
  80.                 </TD>
  81.             </TR>
  82.             <TR class="evenRow">
  83.                 <TD align="right" colspan="2">
  84.                     <INPUT TYPE="submit" name="cmdSubmit" value="<%=GetText("UseTopUpCard")%>">
  85.                 </TD>
  86.             </TR>
  87.         </TABLE>
  88.     </FORM>
  89.     
  90. <%
  91. End If
  92.  
  93. Set objPCTopUpCards    = Nothing
  94. %>
  95. </CENTER>
  96. <!-- #INCLUDE FILE="includes/footer.inc" -->